home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 2410 / 2410.xpi / chrome / content / foxmarks-changeprofile.js < prev    next >
Text File  |  2010-01-28  |  2KB  |  55 lines

  1. /* 
  2.  Copyright 2008 Foxmarks Inc.
  3.  
  4.  foxmarks-changeprofile.js: Implements actions for change profile dialog.
  5.  
  6.  */
  7.  
  8. function ChangeProfileLoad() {
  9.     PasswordChange.password = Xmarks.gSettings.password;
  10.     if (!PasswordChange.password) {
  11.         window.close();
  12.         return;
  13.     }
  14.  
  15.     var menuPopup = document.getElementById("profileMenuPopup");
  16.     
  17.     if (Xmarks.gSettings.viewId) {
  18.         menuPopup.childNodes[Xmarks.gSettings.viewId].label = Xmarks.gSettings.viewName;
  19.         menuPopup.childNodes[Xmarks.gSettings.viewId].hidden = false;
  20.     }
  21.  
  22.     document.getElementById("profileMenuList").value = Xmarks.gSettings.viewId;
  23. }
  24.  
  25. function PasswordChange() {
  26.     var passwordElement = document.getElementById("password");
  27.     if (passwordElement.value == PasswordChange.password) {
  28.         passwordElement.disabled = true;
  29.         Xmarks.gSettings.ClearCredentials();
  30.         LoadProfileNames();
  31.     }
  32. }
  33.  
  34. function LoadProfileNames() {
  35.     Xmarks.FetchProfileNames(null, document.getElementById("profileSpinner"),
  36.         document.getElementById("profileMenuPopup"), NamesLoaded);
  37.     document.getElementById("profileMenuList").value = String(Xmarks.gSettings.viewId);
  38. }
  39.  
  40. function NamesLoaded(response) {
  41.     if (response.count) {
  42.         document.getElementById("profileMenuList").disabled = false;
  43.         document.getElementById("profileMenuList").focus();
  44.     }
  45. }
  46.  
  47. function ChangeProfileOK() {
  48.     window.arguments[0].newProfileId = 
  49.         document.getElementById("profileMenuList").value;
  50.     window.arguments[0].newProfileName =
  51.         document.getElementById("profileMenuList").label;
  52.     return true;
  53. }
  54.  
  55.